package com.member.shop.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import com.member.shop.mapper.SysBizUserDeviceMapper;
import com.member.shop.domain.SysBizUserDevice;
import com.member.shop.service.ISysBizUserDeviceService;

/**
 * 用户设备Service业务层处理
 *
 * @author lixinchen
 * @date 2024-10-28
 */
@Service
public class SysBizUserDeviceServiceImpl extends ServiceImpl<SysBizUserDeviceMapper, SysBizUserDevice> implements ISysBizUserDeviceService {
    @Resource
    private SysBizUserDeviceMapper sysBizUserDeviceMapper;

    /**
     * 查询用户设备
     *
     * @param id 用户设备主键
     * @return 用户设备
     */
    @Override
    public SysBizUserDevice selectSysBizUserDeviceById(Long id) {
        return sysBizUserDeviceMapper.selectById(id);
    }

    /**
     * 查询用户设备列表
     *
     * @param queryWrapper 用户设备
     * @return 用户设备
     */
    @Override
    public List<SysBizUserDevice> selectSysBizUserDeviceList(LambdaQueryWrapper<SysBizUserDevice> queryWrapper) {
        return sysBizUserDeviceMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizUserDevice> selectSysBizUserDeviceList(SysBizUserDevice userDevice) {
        return sysBizUserDeviceMapper.selectSysBizUserDeviceList(userDevice);
    }

    /**
     * 新增用户设备
     *
     * @param sysBizUserDevice 用户设备
     * @return 结果
     */
    @Override
    public int insertSysBizUserDevice(SysBizUserDevice sysBizUserDevice) {
        sysBizUserDevice.setCreateTime(DateUtils.getNowDate());
        return sysBizUserDeviceMapper.insert(sysBizUserDevice);
    }

    /**
     * 修改用户设备
     *
     * @param sysBizUserDevice 用户设备
     * @return 结果
     */
    @Override
    public int updateSysBizUserDevice(SysBizUserDevice sysBizUserDevice) {
        sysBizUserDevice.setUpdateTime(DateUtils.getNowDate());
        return sysBizUserDeviceMapper.updateById(sysBizUserDevice);
    }

    /**
     * 批量删除用户设备
     *
     * @param ids 需要删除的用户设备主键
     * @return 结果
     */
    @Override
    public int deleteSysBizUserDeviceByIds(Long[] ids) {
        return sysBizUserDeviceMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户设备信息
     *
     * @param id 用户设备主键
     * @return 结果
     */
    @Override
    public int deleteSysBizUserDeviceById(Long id) {
        return sysBizUserDeviceMapper.deleteById(id);
    }
}
